package com.hc.dao;

import com.hc.entity.User;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

@Repository
public class UserDao {
    private Map<String, User> userMap = new HashMap<>();

    {
        userMap.put("zhangsan", new User(1001, "zhangsan", "$2a$10$dtz3jsTa8UfEZ9LyYE9Vk.QTLXgXFdMc1NeILA9vqDFqu9H.PXQ9i", "张三"));
        userMap.put("lisi", new User(1002, "lisi", "$2a$10$xl5ThvBVs8qn0MGMRXY/ieU1aCHAZAJbGptGz7bTrmFS7n2BBAWjy", "李四"));
    }

    /**
     * 模拟用户查询
     *
     * @param username
     * @return
     */
    public User getUser(String username) {
        return userMap.get(username);
    }
}
